﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MinhTuan;

public partial class users_Login : System.Web.UI.Page
{
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                String user = Session["user"].ToString();
                int id = int.Parse(user.Split(',')[0]);
                if (id > 0)
                {
                    Response.Redirect("http://localhost:2011/didong/");
                }
            }
        }
        protected void  btndangnhap_Click(object sender, EventArgs e)
        {
            Members mymember = Members.Member_login(txttendangnhap.Text, txtmatkhau.Text);
            if (mymember.Members_Id > 0)
            {
                Session["user"] = mymember.Members_Id + "," + mymember.Members_Name + ",false";
                Response.Redirect("http://localhost:2011/didong/user/welcome.html");
            }
            else
            {
                Ltmessage.Text = "Tên đăng nhập hoặc mật khẩu không đúng";
            }
        }
}
